<template>
  <section class="m-list-table">
    <ym-table :data='data'
              :total="total"
              :loading='loading'
              :options="options"
              limit-height
              border
              :currentPage="currentPage"
              :perPage="perPage"
              @load='handlerLoad'></ym-table>

  </section>
</template>
<script>

import { accMul, accDiv } from '@/utils/calculate'
import dayjs from 'dayjs'
import { cloneDeep } from 'lodash'
import listTable from '@/views/mixins/list-table'
import mixins from './mixins'
export default {
  mixins: [listTable, mixins],
  data () {
    return {
      options: {
        config: [
          {
            label: '标识',
            width: '100',
            render: (h, params) => {
              return h('div', params.row.id)
            }
          },
          {
            label: '用户名称',
            render: (h, params) => {
              let { username } = params.row
              return h('div', username)
            }
          },
          {
            label: '主图',
            width: '100',
            render: (h, params) => {
              return h('div', [
                h('ym-upload-image', {
                  props: {
                    readonly: true,
                    value: params.row.主图,
                    width: '50',
                    height: '50'
                  }
                })
              ])
            }
          },
          {
            label: '名称',
            render: (h, params) => {
              return h('div', params.row.卡券名称)
            }
          },
          {
            label: '购买价',
            render: (h, params) => {
              return h('div', params.row.购入价 + '元')
            }
          },
          {
            label: '剩余金额',
            render: (h, params) => {
              return h('div', params.row.剩余金额 + '元')
            }
          },
          {
            label: '消费折扣',
            render: (h, params) => {
              return h('div', params.row.消费折扣 + '%')
            }
          },
          {
            label: '购入时间',
            width: "160",
            render: (h, params) => {
              return h('div', this.formatDate1(params.row.购入时间, "YYYY-MM-DD HH:mm:ss"))
            }
          },
          {
            label: '过期时间',
            width: "160",
            render: (h, params) => {
              return h('div', this.formatDate1(params.row.过期时间, "YYYY-MM-DD HH:mm:ss"))
            }
          },
          {
            label: '状态',
            render: (h, params) => {
              let { NodeType } = params.row
              return h('div', NodeType && NodeType.namecode)
            }
          }
        ]
      }
    }
  },

  methods: {

  }
}
</script>
<style lang="scss" scoped>
</style>
